﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using NUnit.Framework;
using Spring.Context;
using Spring.Context.Support;
using CondominioG1.Persistencia.NHibernate;
using CondominioG1.Negocio;
using CondominioG1.Dominio;

namespace CondominioG1.Pruebas.TestService
{
    [TestFixture]
    public class TestReservaService
    {
        private IApplicationContext Spring;

        [TestFixtureSetUp]
        public void InicializarPruebas()
        {
            //"assembly://assembly/namespace/capaPersistencia.xml",
            Spring = new XmlApplicationContext(
                "assembly://CondominioG1/CondominioG1/capaPersistencia.xml",
                "assembly://CondominioG1/CondominioG1/capaNegocio.xml"
                );
        }

        [Test]
        public void TestRealizarReserva()
        {
            ReservaService reservaService = (ReservaService)Spring.GetObject("reservaService");
            Assert.NotNull(reservaService);
            Reserva reserva = null;
            Assert.DoesNotThrow(delegate
            {
                reserva = reservaService.RealizarReserva(DateTime.Now, 2, "acerna", "A001", "reservado");
            });
            Assert.NotNull(reserva);
            Assert.Greater(reserva.Numero, 0);

        }

    }
}